﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title></title>
    <link href="../CSS/style1.css" rel="stylesheet" type="text/css" />
    <link href="../CSS/style4.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.showModalDialog.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.pager.js" type="text/javascript"></script>
    
    <script type="text/javascript">
         function showCustomer() {
             $.showModalDialog("../publicPage/SelectCustomer.htm?data=" + Math.random(), null, 400, 320, function (C) {
                 if (C) {
                     $("#txtId").val(C.CusID);
                     $("#txtCName").val(C.CusName);
                 }
             });

         };
        $(function () {
            $.ajax({
                url: "ServiceCreate.asmx/SelectServiceType",
                type: "post",
                data: JSON.stringify({}),
                dataType: "json",
                contentType: "application/json",
                success: function (obj) {
                    var sel2 = $("#select1");
                    for (var i = 0; i < obj.d.length; i++) {
                        sel2.append('<option value="' + obj.d[i].STID + '">' + obj.d[i].STName + '</option>');
                    }
                }, error: function (xmlhttp) {
                    alert("错误：" + xmlhttp.responseText);
                }
            });
        });

       function ok() {
           var cus = {
               action: "Add",
               ID: $("#txtId").val(),
               STID: $("#select1").val(),
               CSTitle: $("#txtGy").val(),
               CSDesc: $("#txtXq").val(),
               CSName: $("#txtCName").val()
           };
           $.post("ServiceAllot.ashx", cus, function (r) {
               if (r == "1") {
                   alert("创建服务成功");
                   location.href = "/CustomerService/ServiceAllot.htm";
               } else {
                   alert("创建服务失败");
               }
           });
       };

    </script>
</head>
<body>
    <table class="tableEdit" id="headDiv" style="width:600px;">
        <tr>
            <td colspan="4">创建服务</td>
            
        </tr>
    </table>
    <table  class="tablebody" id="tab1" style="width:600px;">
        <tr>
            <th>客户编号：</th>
            <td><input type="text" readonly="readonly" id="txtId" style="color:blue;width:100px" ondblclick="showCustomer();" /></td>
            <th>服务类型：</th>
            <td>
                <select style="width:80px" id="select1">
                    
                </select>
            </td>
        </tr>
        <tr>
            <th>服务概要：</th>
            <td><textarea id="txtGy" style="color:blue;height:30px;width:90%"></textarea></td>
            <th>客户名称：</th>
            <td><input type="text" readonly="readonly" id="txtCName" style="height:18px;width:150px" /></td>
        </tr>
        <tr>
            <th>详细信息：</th>
            <td colspan="3"><textarea id="txtXq" style="color:blue;width:93%;height:120px"></textarea></td>
        </tr>
        <tr>
            <td colspan="4" style="text-align:center"><input type="button" value="确定" onclick="ok();" />&nbsp;&nbsp;</td>
        </tr>
    </table>

</body>
</html>
